import { Switch, Route } from 'react-router-dom';

/**
 * @param {*} props 
 * interface IRoute {
 *      path: string;
 *      component: React.Component;
 * }
 * 
 * interface IRouterViewProps {
 *      routes: [];
 * }
 * @returns 
 */
export default function (props) {
    return (
        <Switch>
            {
                props.routes.map((r) => (
                    <Route 
                        exact={ r.path === '/' } 
                        path={ r.path }
                        key={ r.path }
                    >
                        <r.component />
                    </Route>
                ))
            }
        </Switch>
    );

}
